[Python] - Getting data from external program

Posted by Kenny M. on Stack Overflow See other posts from Stack Overflow or by Kenny M.
Published on 2010-04-05T04:47:23Z Indexed on 2010/04/05 4:53 UTC
Read the original article Hit count: 352

Filed under:
|

Hey,

I need a method to get the data from an external editor.

def _get_content():
     from subprocess import call
     file = open(file, "w").write(some_name)
     call(editor + " " + file, shell=True)
     file.close()
     file = open(file)
     x = file.readlines()

     [snip]

I personally think this is a very ugly way. You see I need to interact with an external editor and get the data.

Do you know any better approaches/have better ideas?

© Stack Overflow or respective owner

Related posts about python

Related posts about data